-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate unique UIDs and GIDs #663
Conversation
cb2ba1b
to
8e15caf
Compare
8e15caf
to
745d7c6
Compare
rebased on main and resolved conflicts |
12c61bb
to
75fe88c
Compare
I extracted the new code to handle temporary users and groups into a separate package and added some more tests. |
0eb85a5
to
e186eca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're almost there, some further nits and suggestions.
I was wondering, since there are some common code paths in groups and users temporary entries registration, would be possible to do some logic deduplication, or is it not possible?
e0ac675
to
3a2e9b0
Compare
3a2e9b0
to
58cc388
Compare
Rebased on main |
Should have been removed by 4fd03a4.
It seems to be unused since ddbba26.
Combine TestUserByID and TestUserByName, TestGroupByID and TestGroupByName, because the test bodies were identical (except for the called function).
* Remove obsolete tests: They were testing behavior which has changed. * Fix tests by using either predictable UIDs or replacing UIDs in golden files with placeholders (normalizing) * Limit number of pre-auth user records to avoid denial of service by sending many SSH requests for unique users to fill up the UID range. * Remove field UID from users.UserInfo struct because it's not set in internal/brokers/broker.go anymore and there is no need to expose this field. * Rename localgroups package to localentries because it now also provides functions for passwd entries. * Check for error when calling getpwent or getgrent
We only need to unset it once we've used it in a loop, while in the other cases we'd expect it being set or unset by the function that has been called
Added tests too
b664389
to
eaeae48
Compare
@3v1n0 Anything missing for your approval? |
No, a part me remembering of hitting the green button :-D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for spending time in getting authd the less racy we can!
These changes have already partly been reviewed in https://github.com/canonical/authd-private/pull/9.
Closes #509
UDENG-5416
UDENG-4352